﻿<!DOCTYPE html>
<!--[if lt IE 7]><html class="ie ie6" lang="zh-cn"><![endif]-->
<!--[if IE 7]><html class="ie ie7" lang="zh-cn"><![endif]-->
<!--[if IE 8]><html class="ie ie8" lang="zh-cn"><![endif]-->
<!--[if IE 9]><html class="ie ie9" lang="zh-cn"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="zh-cn"><!--<![endif]-->
<head>
	<meta charset="utf-8" />
	<title>文件引用</title>
	<link rel="stylesheet" type="text/css" href="http://aimi.li/cmf/css/common.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="../css/style.css" media="screen" />
	<link rel="stylesheet" type="text/css" href="../snippet/rainbow-min.css" media="screen" />
	<script type="text/javascript" src="../js/jquery-1.5.1.min.js"></script>
</head>
<body>
	<div class="ui_m">
		<h2 class="ui_h2">文件引用</h2>

		<div class="ui_m_item">
			<h3 class="ui_h3">CSS</h3>
			<div class="ui_con">
				<p>单个页面允许引用2个CSS文件，包含”common.css“和”单页样式.css“；</p>
				<p>若存在业务公共样式，则允许使用3个，如下：</p>
				<pre class="snippet" data-language="html">
					<link rel="stylesheet" type="text/css" href="http://aimi.li/cmf/css/common.css" media="screen" />
					<link rel="stylesheet" type="text/css" href="http://aimi.li/cmf/css/业务公共样式.css" media="screen" />
					<link rel="stylesheet" type="text/css" href="http://aimi.li/cmf/css/单页样式.css" media="screen" />
				</pre>
			</div>
		</div>
		<div class="ui_m_item">
			<h3 class="ui_h3">Javascript</h3>
			<div class="ui_con">
				<p>单个页面允许引用2个JS文件，包含”jQuery-lastest.min.js“和”单页脚本.js“；</p>
				<p>若存在业务公共脚本，则允许使用3个，如下：</p>
				<pre class="snippet" data-language="html">
					<link rel="stylesheet" type="text/css" href="http://aimi.li/cmf/js/jquery-latest.min.js" media="screen" />
					<link rel="stylesheet" type="text/css" href="http://aimi.li/cmf/js/业务公共脚本.js" media="screen" />
					<link rel="stylesheet" type="text/css" href="http://aimi.li/cmf/js/单页脚本.js" media="screen" />
				</pre>
			</div>
		</div>
	</div>

	<script src="../snippet/rainbow-min.js"></script>
	<script type="text/javascript">
		(function( $ ) {
			$.fn.prettyPre = function( method ) {
				var defaults = {
					ignoreExpression: /\s/ // what should be ignored?
				};

				var methods = {
					init: function( options ) {
						this.each( function() {
							var context = $.extend( {}, defaults, options );
							var $obj = $( this );
							var text = $obj.get( 0 ).innerHTML;

							// use the first line as a baseline for how many unwanted leading whitespace characters are present
							var superfluousSpaceCount = 0;
							var currentChar = text.substring( 0, 1 );

							while ( context.ignoreExpression.test( currentChar ) ) {
								currentChar = text.substring( ++superfluousSpaceCount, superfluousSpaceCount + 1 );
							}

							// split
							var parts = text.split( "\n" );
							var reformattedText = "";

							// reconstruct
							var length = parts.length;
							for ( var i = 0; i < length; i++ ) {
								// cleanup, and don't append a trailing newline if we are on the last line
								reformattedText += parts[i].substring( superfluousSpaceCount ) + ( i == length - 1 ? "" : "\n" );
							}

							$obj.html( reformattedText );
						} );
					}
				}

				if ( methods[method] ) {
					return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ) );
				}
				else if ( typeof method === "object" || !method ) {
					return methods.init.apply( this, arguments );
				}
				else {
					$.error( "Method " + method + " does not exist on jQuery.prettyPre." );
				}
			}
		} )( jQuery );

		$(window).load(function () {
			Rainbow.color(function () {
				$('pre').prettyPre();
			});  
		});
	</script>
</body>
</html>